home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / sources / menu.cp < prev    next >
Encoding:
Text File  |  2000-06-23  |  1.8 KB  |  68 lines

  1. /*
  2.     File:        Menu.cp
  3.  
  4.     Contains:    TMenubar is a simple object that keeps track of the menubar     
  5.                   TMenu.cp contains TMenubar member functions.
  6.  
  7.     Written by: Kent Sandvik    
  8.  
  9.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  10.  
  11.                 You may incorporate this Apple sample source code into your program(s) without
  12.                 restriction. This Apple sample source code has been provided "AS IS" and the
  13.                 responsibility for its operation is yours. You are not permitted to redistribute
  14.                 this Apple sample source code as "Apple sample source code" after having made
  15.                 changes. If you're going to re-distribute the source, we require that you make
  16.                 it clear in the source that the code was descended from Apple sample source
  17.                 code, but that you've made changes.
  18.  
  19.     Change History (most recent first):
  20.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  21.                 
  22.  
  23. */
  24. // HEADER FILES
  25. #ifndef _MENU_
  26. #include "Menu.h"
  27. #endif
  28.  
  29.  
  30. //    CONSTRUCTORS AND DESTRUCTORS
  31. #pragma segment Menu
  32. TMenubar::TMenubar(short ResourceID)
  33. // Constructor, create a visible menu bar.
  34. {
  35.     Handle aMenubar = NULL;
  36.  
  37.     // Load the MBAR resource defined in the ID.
  38.     aMenubar = ::GetNewMBar(ResourceID);
  39.     ASSERT(aMenubar != NULL, "\pProblems loading in MBAR");
  40.  
  41.     if(aMenubar != NULL)
  42.     {
  43.         ::SetMenuBar(aMenubar);                        // install menus
  44.         ::DisposeHandle(aMenubar);                    // don't need it any longer    
  45.     
  46.         ::AppendResMenu(::GetMenuHandle(mApple), 'DRVR');    // add DA names to Apple menu
  47.     
  48.         ::DrawMenuBar();                            // install the menu bar itself
  49.     }
  50. }
  51.  
  52.  
  53. #pragma segment Menu
  54. TMenubar::~TMenubar()
  55. // Default destructor -- empty for the time being.
  56. {
  57. }
  58.  
  59.  
  60. // _________________________________________________________________________________________________________ //
  61.  
  62.  
  63. /*    Change History (most recent last):
  64.   No        Init.    Date        Comment
  65.   1            khs        12/21/92    New file
  66.   2            khs        1/7/93        Cleanup
  67. */
  68.